Refresh Button for Map Positions with Notification Pop-Ups#506
Refresh Button for Map Positions with Notification Pop-Ups#506
Conversation
…, elapsed time in tooltip Co-authored-by: Cursor <cursoragent@cursor.com>
|
@jimjeffers - This is ready for your review. Please read the note to make sure you don't disagree with how this was implemented (follows current deployment map implementation). |
|
Thanks for putting this together. The feature direction is strong, but I think these 4 issues should be addressed before merge. 1) 24h fallback is mostly inactive because query
|

Refresh button on maps
RefreshButtoninpackages/react-uithat matches existing map control styling.onRequestRefresh,refreshLoading,refreshLastRefreshed, etc.) and renders the refresh button next to the existing buttons not the mapuseRefreshPositionshookapps/lrauv-dash2/lib/useRefreshPositions.tsxthat:lastRefreshed, and exposesmarkInitialLoadDoneso the “next refresh” countdown can start after the first position load.vehiclePosquery keys so refresh updates the same data the map/paths use.formatElapsedTimehelperpackages/utilsto format a duration in ms as a short string (e.g.45s,23m,5h:30m,2d:12h,6M,2y).Deployment map and overview map
DeploymentMapand the overview map on the index page useuseRefreshPositionsand passrefreshAll,refreshLoading,lastRefreshed, and related props into the shared Map component so the new refresh button appears and works on both maps.preferredParams(e.g. deployment time range) can be passed so the hook aligns with the map’s time window.VehiclePath and “first load” timing
VehiclePathnow accepts anonPositionDataLoadedcallback and calls it once when position data (e.g. GPS fixes) is first available.markInitialLoadDoneso the refresh tooltip’s “last reload” / “next auto-refresh” countdown starts when the path data has loaded (with a 30s fallback if no path ever loads).Default “from” for position queries
fromof 24 hours ago instead of0.VehicleListandVehiclePathso the map can show recent positions even without deployment bounds.Vehicle path tooltip
formatElapsedTimefor the “time since” part so it matches the refresh button’s compact format.Styling
packages/react-ui/src/css/base.cssupdated with styles for the refresh button and the refresh-position toast.Exports
formatElapsedTimeis exported from@mbari/utils.Refresh button
NOTE: In dash4, the map only shows the positions of the vehicle for the last 24 hours, whereas, dash5 shows either the positions since the beginning of an active deployment or it shows the entirety of the vehicle path for a recent previous deployment. The notifications for each reflect what is shown on the map (ie the number of GPS fixes will be much higher on dash5 since it is showing more positions).